<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>版本管理工具</title>
	<link rel="stylesheet" type="text/css" href="<?=base_url('public/css/typo.css')?>" />
	<link rel="stylesheet" type="text/css" href="<?=base_url('public/css/common.css')?>" />
	
	<script type="text/javascript" src="<?=base_url('public/js/jquery-2.1.3.min.js')?>"></script>
	<script type="text/javascript" src="<?=base_url('public/js/common.js')?>"></script>
</head>
<body>
	<h1>版本管理工具 - <?=$title?></h1>		
	<div id="body">	
		<div id="content">
		<?php if ($act=='add_app_file'):?>	
			<span><a href="#" onclick="addFilePanel()">增加文件</a></span>
		<?php endif;?>
		<?=form_open_multipart('app/submitForm', '', $hidden)?>	
		<table style="width: 100%; margin: 10px 0; border: none;">
			<?php if ($act=='delete_app_edition' || $act=='delete_app_file' || $act=='delete_applib' || $act=='delete_applib_version' || $act == 'delete_app'):?>		
				<tr>								
					<td>
						<img src="<?=base_url('public/images/info.png')?>" style="width: 30px; height: 30px; vertical-align: text-bottom;" /> <span style="color: red;">危险操作，确定删除请输入YES，数据不可恢复。</span></td>					
				</tr>
				<tr>
					<td><input type="text" name="command" /></td>
				</tr>
				<tr>								
					<td><input type="submit" value="提交" /></td>
					<td></td>
				</tr>
			<?php elseif ($act=='add_app_version'):?>	
				<tr>								
					<td>版本名</td>
					<td><input type="text" name="version_id" /></td>
				</tr>
				<tr>								
					<td><input type="submit" value="提交" /></td>
					<td></td>
				</tr>
			<?php elseif ($act=='add_applib_version'):?>
				<tr style="text-align: left;">
					<th>应用标识</th>
					<th>应用版本</th>
				</tr>
				<?php if (!empty($list)):?>					
					<?php foreach($list as $item):?>
						<tr>
						<td>
							<input type="checkbox" name="app_id" value="<?=$item['app_id']?>">
							<?=$item['app_id']?>
						</td>
						<td>
							<?php if (!empty($item['versions'])):?>
								<?php foreach($item['versions'] as $version):?>
								<input type="radio" name="<?=$item['app_id']?>" value="<?=$version['edition_id']?>_<?=$version['edition_ver']?>">
								<span><?=$version['edition_id']?></span>									
								&nbsp;&nbsp;
								<?php endforeach;?>
							<?php endif;?>
						</td>
						</tr>												
					<?php endforeach;?>					
					<tr>								
						<td><input type="submit" value="提交" /></td>
						<td></td>
					</tr>
				<?php else:?>
					<tr>
						<td>没有应用可以添加.<td>
						<td><td>
					</tr>
				<?php endif;?>									
				<script type="text/javascript">
				$(document).ready(function(){
					selectStrategyApp();
				});						
				</script>											
			<?php elseif ($act=='deploy_applib_version'):?>	
				<thead>
				<tr>
					<td></td>
					<th>部署服务器名称</th>
					<th>部署服务器ip</th>
					<th>部署目录</th>					
				</tr>
				</thead>
				<!-- 列出服务器及部署路径 -->
				<?php if(empty($sftp)):?>
					<tr>
						<td>请设置部署的服务器！/application/config/common.php $config['sftp']</td>
						<td></td>
					</tr>
				<?php else:?>
					
				<?php foreach($sftp as $item):?>
					<tr>
						<td><input <?=(count($sftp)==1)?'checked':''?> type="radio" name="sftp" value="<?=$item['id']?>"></td>
						<td><?=$item['name']?></td>
						<td><?=$item['host']?></td>
						<td><?=$item['deploy']?></td>
					</tr>
				<?php endforeach;?>
				
				<tr>								
					<td></td>
					<td><input type="submit" value="提交" /></td>					
				</tr>
				<?php endif;?>								
			<?php else:?>	
			<tr>								
				<td>文件路径</td>
				<td>文件源地址</td>
			</tr>
			<tr>								
				<td><input type="text" name="path1" value="<?=($act=='update_app_file'||$act=='add_app_file')?$file_path:""?>"></td>
				<td><input type="file" name="file1" value=""></td>
			</tr>
			<tr>								
				<td><input type="submit" value="提交" /></td>
				<td></td>
			</tr>						
			<?php endif;?>			
		</table>
		</form>
		</div>
	</div>
	<p class="footer">powered by yanming &copy; <?=date("Y")?></p>	
</div>
</body>
</html>